//
//  LLYErrorManager.m
//  LianluoContact
//
//  Created by appbegin on 14-9-18.
//  Copyright (c) 2014年 appbegin. All rights reserved.
//

#import "LLYErrorManager.h"

@interface LLYErrorManager()
{
    
}
@property (strong, nonatomic) NSDictionary *httpsErrorMsgDic;
@end
@implementation LLYErrorManager

- (NSString *)httpsErrorMsgByErrorCode:(NSString *)code
{
    NSString *msg;
    if (code != nil) {
        msg = [self.httpsErrorMsgDic objectForKey:[NSString stringWithFormat:@"%@",code]];
        if (msg == nil || [msg isEqualToString:@""]) {
            msg = @"异常错误";
        }
    }
    return msg;
}

//json get方法
-(NSDictionary *)httpsErrorMsgDic
{
    if (_httpsErrorMsgDic == nil)
    {
        // 得到资源文件路径
        NSString *path = [[NSBundle mainBundle] pathForResource:@"httpsErrorMsg" ofType:@"json"];
        NSData *data = [NSData dataWithContentsOfFile:path];
        _httpsErrorMsgDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
    }
    return _httpsErrorMsgDic ;
}
@end
